<!DOCTYPE html>
<html>
<head>
  <title>skynet WebSocket example</title>
</head>
<body>   
  <script> 
    //var ws = new WebSocket('ws://112.74.28.34:8001/ws');
  //  var ws = new WebSocket('ws://120.76.234.46:8001/ws');
    var ws = new WebSocket('ws://120.76.234.46:8888');
 //  var ws = new WebSocket('ws://101.37.135.239:18888');
 //  var ws = new WebSocket('ws://t.91laoyou.com:8888');

    ws.onopen = function(){   
        ws.send( '{"cmd":9,"account":"a","password":"123456"}');    

    //   {"cmd":9,"account":"a1","password":"123456"}  
    //   {"cmd":9,"account":"a2","password":"123456"}  

    //   {"cmd":9,"account":"a3","password":"123456"} 
    //   {"cmd":9,"account":"bbbbbbbbbb","password":"123456"}

    //   {"cmd":120,"optionType":111,"ruleType":0,"total_ju":2,"room_id":564339}

//           {"cmd":9,"account":"a1","password":"123456"}

//           {"cmd":130,"room_odds":1,"optionType":111,"gameType":130,"ruleType":3,"total_ju":10,"room_id":111111,"fid":86569}        {"cmd":1104}

//  {"cmd":106,"room_id":111111}            {"cmd":356}

//  牛牛抢庄        {"cmd":134,"bank_odds":2}
//  牛牛赔率        {"cmd":136,"odds":2}
//  牛牛弃牌        {"cmd":142,"card":2}     {"cmd":144}
//  牛牛弃牌        {"cmd":140,"card":2} 


    };
    var i  = 1;
    ws.onmessage = function(ev){
        //服务器 返回的消息
        //得到 房间ip
         ws.send( '{"cmd":1102,"game_type":1,"hu_type":2,"total_ju":2,"room_id":456234}');   

         ws.send( '{"cmd":1203,"game_type":1,"hu_type":2,"total_ju":2,"room_id":456234}');   
         //南昌麻将创建房间
         ws.send( '{"cmd":104,"game_type":1,"ruleType":1,"total_ju":2,"optiontype":1,"room_id":456234}');  
         //宜丰麻将创建房间
         ws.send( '{"cmd":120,"optionType":111,"ruleType":1,"total_ju":2,"room_id":412334}');  
         //宜丰麻将 加入房间 
         ws.send( '{"cmd":106,"room_id":456234}');   
        if (i > 2){ 
          alert(ev.data);  
        }
        if (i == 22222){ 
          //  {"cmd":355}      {"cmd":376}   {"cmd":356}  {"cmd":450,"msg":"sadfwe","time":456234}
      // ws.send( '{"cmd":1104,"game_type":2,"hu_type":2,"total_ju":2,"room_id":456234}');  

//    {"cmd":130,"optionType":1,"ruleType":2,"total_ju":2,"room_id":6666}
//    {"cmd":106,"room_id":6666}      {"cmd":2001,"room_id":6666,"uid":6666}
//    {"cmd":134,"bank_odds":2}


// {"cmd":23,"content":"234234","typ":"1","send_type":1}  
         ws.send( '{"cmd":120,"game_type":2,"hu_type":2,"total_ju":2,"room_id":888888}');   
        }
        i++;
    };
    ws.onclose = function(ev){
  //    alert("close");
    };
    ws.onerror = function(ev){ 
      var description = ''
      for(var i in ev){ 
         var property=ev[i]; 
         description+=i+" = "+property+"\n"; 
       } 
  // alert(description);  
    };

  </script>
</body>
</html>
